import { reactive } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
import { DICT_TYPE } from '@/utils/dict'
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
})
// CrudSchema
const crudSchemas = reactive<CrudSchema[]>([
    {
      label: 'id',
      field: 'id',
      type: 'index',
      form: {
         show: false
      },
      detail: {
         show: false
      }
    },
    {
      label: '开始时间',
      field: 'date',
      form: {
          show: true,
          component: 'DatePicker',
          componentProps: {
              type: 'datetime',
              valueFormat: 'YYYY-MM-DD HH:mm:ss'
          }
      },
      search: {
         show: true,
         component: 'DatePicker',
         componentProps: {
             type: 'datetimerange',
             valueFormat: 'YYYY-MM-DD HH:mm:ss'
         }
      }
    },
    {
      label: '色（度）',
      field: 'color',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '嗅和味',
      field: 'taste',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '水温',
      field: 'waterTemp',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '浑浊度',
      field: 'turbidity',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: 'PH',
      field: 'ph',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '肉眼可见物',
      field: 'visible',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '亚硝酸盐氮',
      field: 'no3N',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: 'COD',
      field: 'cod',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '氨氮',
      field: 'nh3N',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '总大肠菌群',
      field: 'coliforms',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '耐热大肠菌群',
      field: 'thermostableColiforms',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '细菌总数',
      field: 'bacteria',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '总硬度',
      field: 'hardness',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '氯化物',
      field: 'chloride',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '铁',
      field: 'fe',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '挥发酚',
      field: 'volatilePhenol',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '锰',
      field: 'mn',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '砷',
      field: 'arsenic',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '铬',
      field: 'cr',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '氰化物',
      field: 'kcn',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '总磷',
      field: 'p',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '藻类	',
      field: 'algae',
      form: {
          show: true,
      },
      search: {
         show: true
      }
    },
    {
      label: '创建时间',
      field: 'createTime',
      form: {
         false
      },
      search: {
         show: true,
         component: 'DatePicker',
         componentProps: {
             type: 'datetimerange',
             valueFormat: 'YYYY-MM-DD HH:mm:ss'
         }
      }
    },
    {
        label: t('table.action'),
        field: 'action',
        width: '240px',
        form: {
            show: false
        },
        detail: {
            show: false
        }
    }
])

export const { allSchemas } = useCrudSchemas(crudSchemas)